<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    /*
    一个布尔值，如果是 true，则意味着对象应 该用 Array.prototype.concat()打平其数组元素
    true:打平
    false:不打平
     */

    // 1.例子,普通数组中值默认为true,需要改成false
    let arr1 = [1,2]
    let arr2 = [2]
    console.log('普通',arr1.concat(arr2))  // [1,2,2]
    arr1[Symbol.isConcatSpreadable] = false;
    console.log('使用后',arr1.concat(arr2)) // [[1,2],2]

    // 2.类数组,默认为undefined,不打平
    let arrayLikeObject = {length:1,0:'baz'}
    console.log(arrayLikeObject[Symbol.isConcatSpreadable]); // undefined
    console.log(arr2.concat(arrayLikeObject)) //[2,{}]
    arrayLikeObject[Symbol.isConcatSpreadable] = true;
    console.log(arr2.concat(arrayLikeObject)) //[2,'baz']

    // 3.Set和上面一样




</script>
</body>
</html>